#ifndef _H_C_RUNNER_H_
#define _H_C_RUNNER_H_

#include "CCoroutine.h"

namespace TB
{
	class CRunner
	{
		NON_COPYABLE(CRunner)
		NON_MOVEABLE(CRunner)
	public:
		CRunner(const std::weak_ptr<CThreadPool>& poThreadPool = {});
		inline void Post(const std::function<void()>& rcbFunction) { return m_poCoroutine->Post(rcbFunction); }
		inline void Post() { m_poCoroutine->Post(); }
		inline void SetUserData(const std::weak_ptr<ICoroutineUserData>& poUserData) { m_poCoroutine->SetUserData(poUserData); }
		inline std::weak_ptr<ICoroutineUserData>& GetUserData() { return m_poCoroutine->GetUserData(); }
		inline const std::weak_ptr<ICoroutineUserData>& GetUserData() const { return m_poCoroutine->GetUserData(); }
		inline UINT64 GetID() const { return m_poCoroutine->GetID(); }
		inline const std::weak_ptr<CThreadPool>& GetThreadPool() const { return m_poCoroutine->GetThreadPool(); }
		inline std::weak_ptr<CThreadPool>& GetThreadPool() { return m_poCoroutine->GetThreadPool(); }

	private:
		std::shared_ptr<CCoroutine> m_poCoroutine;
	};
}

#endif
